home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
c_lib.arc
/
PCWAIT.C
< prev
next >
Wrap
Text File
|
1990-08-09
|
2KB
|
54 lines
/**
*
* Name pcwait -- Return the value of the exit code
*
* Synopsis excode = pcwait(pretype);
* int excode Returned exit code
* int *pretype The manner of exit from the invoked
* process.
*
* Description This function returns the exit code which is set by
* the procedure PCEXIT in a invoked process (one called
* using PCEXEC or PCDOSCMD). The manner in which the
* the child process terminated is returned as well. The
* exit code is returned only once; subsequent calls to
* PCWAIT return zero values.
*
* Returns excode The value of the exit code, a number
* between 0 and 255 set by PCEXIT.
* pretype Pointer to a integer in which the manner
* of exit is returned. The values are:
* 0 - Normal Termination
* 1 - Ctrl/Break
* 2 - Critical Device Error
* 3 - Terminated using DOS function 31 (hex)
* (terminate but stay resident).
*
* Version 1.1 (C)Copyright Blaise Computing Inc. 1983, 1984
*
**/
#define uthibyte(a) (((a)>>8)&0x00ff) /* High byte of a */
#define utlobyte(a) ((a)&0x00ff) /* Low byte of a */
#define utbyword(a,b) (((a)<<8)|((b)&0x00ff)) /* a is high, b low */
struct dreg
{
unsigned ax,bx,cx,dx,si,di,ds,es;
};
#define DOSREG struct dreg
int pcwait(pretype)
int *pretype;
{
DOSREG dos_reg;
utinit(&dos_reg);
dos_reg.ax = utbyword(0x4d,0); /* Function call hex 4D */
dos(&dos_reg);
*pretype = uthibyte(dos_reg.ax);
return(utlobyte(dos_reg.ax));
}